//
// Created by zhuyijun on 2021/8/20.
//

#ifndef BASE_STRING_H
#define BASE_STRING_H

#include <iostream>

using std::ostream;
using std::istream;

class String {
private:
    char *str;
    int len;
    static int num_strings;
    static const int CINLIM = 80;
public:
    String(const char *s);

    String();

    String(const String &);

    ~String();

    int length() const {
        return len;
    }

    //运算符重载
    String &operator=(const String &);

    String &operator=(const char *);

    char &operator[](int i);

    const char &operator[](int i) const;

    //友元
    friend bool operator<(const String &st, const String &st2);

    friend bool operator>(const String &st1, const String &st2);

    friend bool operator==(const String &st, const String &st2);

    friend ostream &operator<<(ostream &os, const String &st);

    friend istream &operator>>(istream &is, String &st);

    //静态函数
    static int HowMany();
};


#endif //BASE_STRING_H
